package com.example.mp.exception;


public class BusinessException extends RuntimeException {
    private static final long serialVersionUID = 8882366904034518521L;

    private Integer code;
    private String message;
    private boolean customMsg = false;


    public BusinessException(Integer code) {
        this.code = code;
        if (!"200".equals(code)) {
            this.message = "发生错误，调用失败";
        }

    }

    public BusinessException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    public BusinessException(Integer code, String message, Throwable cause) {
        super(cause);
        this.code = code;
        this.message = message;
    }

    public BusinessException(Integer code, String message, boolean customMsg) {
        this.code = code;
        this.message = message;
        this.customMsg = customMsg;
    }

    public Integer getCode() {
        return this.code;
    }

    public void setCode(Integer code) {
        this.code = code;
    }

    public String getMessage() {
        return this.message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String toString() {
        return "code ..." + this.code;
    }

    public boolean isCustomMsg() {
        return this.customMsg;
    }

}
